package com.khyr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.khyr.entity.HisCareHistory;
import com.khyr.entity.HisPatient;
import com.khyr.entity.HisPatientFile;
import com.khyr.service.PatientLibraryService;
import com.khyr.vo.GetPatientAllMessageByPatientIdVo;
import com.khyr.vo.PatientLibrarySearchVo;
import com.khyr.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：Zhang
 * @date ：Created in 2025/3/12 15:34
 * @description：患者库
 * @modified By：
 * @version: 1.0
 */
@RestController
@RequestMapping("/seeADoctor/PatientLibrary")
public class PatientLibraryController {
    @Autowired
    private PatientLibraryService patientLibraryService;
    /**
     * @create by: Zr
     * @description: 用于查询患者库的表格中的信息，可模糊查询,可分页
     * @create time: 2025/3/12 16:38
     * @param patientLibrarySearchVo
     * @return com.khyr.vo.R<com.baomidou.mybatisplus.extension.plugins.pagination.Page<com.khyr.entity.HisPatient>>
     */
    @PostMapping("/PatientLibrarySearch")
    public R<Page<HisPatient>> patientLibrarySearch(@RequestBody PatientLibrarySearchVo patientLibrarySearchVo) {
        return patientLibraryService.patientLibrarySearch(patientLibrarySearchVo);
    }
    /**
     * @create by: Zr
     * @description: 根据患者id查询患者信息
     * @create time: 2025/3/12 16:40
     * @param patientId
     * @return com.khyr.vo.R<com.khyr.entity.HisPatient>
     */
    @GetMapping("/getPatientById/{patientId}")
    public R<HisPatient> getPatientById(@PathVariable String patientId) {
        return patientLibraryService.getPatientById(patientId);
    }
    /**
     * @create by: Zr
     * @description: 根据id获取患者档案信息
     * @create time: 2025/3/12 16:48
     * @param patientId
     * @return com.khyr.vo.R<com.khyr.entity.HisPatientFile>
     */
    @GetMapping("/getPatientFileById/{patientId}")
    public R<HisPatientFile> getPatientFileById(@PathVariable String patientId) {
        return patientLibraryService.getPatientFileById(patientId);
    }
    /**
     * @create by: Zr
     * @description: 通过患者id查询病例及处方信息
     * @create time: 2025/3/13 16:00
     * @param patientId
     * @return com.khyr.vo.R<java.util.List<com.khyr.entity.HisCareHistory>>
     */
    @GetMapping("/getPatientAllMessageByPatientId/{patientId}")
    public R<List<HisCareHistory>> getPatientAllMessageByPatientId(@PathVariable String patientId) {
        return patientLibraryService.getPatientAllMessageByPatientId(patientId);
    }
    /**
     * @create by: Zr
     * @description: 根据患者身份证号查询患者信息
     * @create time: 2025/3/13 16:04
     * @param idCard
     * @return com.khyr.vo.R<com.khyr.entity.HisPatient>
     */
    @GetMapping("/getPatientInfoByIdCar/{idCard}")
    public R<HisPatient> getPatientInfoByIdCar(@PathVariable String idCard) {
        return patientLibraryService.getPatientInfoByIdCar(idCard);
    }



}
